<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>

<html>
<head>
    <title>房源信息</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            background: linear-gradient(to right, #f5f7fa, #c3cfe2);
        }

        /* 导航栏样式 */
        .navbar {
            background: linear-gradient(to right, #4CAF50, #6a9e8d);
            overflow: hidden;
            display: flex;
            justify-content: space-between;
            padding: 10px 20px;
        }

        .navbar .btn {
            display: flex;
            align-items: center;
        }

        .navbar .btn a {
            display: block;
            color: white;
            text-align: center;
            padding: 10px 15px;
            text-decoration: none;
            cursor: pointer;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }

        .navbar .btn a:hover {
            background-color: #575757;
        }

        .navbar .btn a img {
            margin-right: 5px;
            vertical-align: middle;
            height: 20px;
            width: 20px;
        }

        /* 页面主体容器 */
        .container {
            padding: 40px;
            min-height: calc(100vh - 80px);
        }

        /* 卡片样式 */
        .card {
            background-color: white;
            border-radius: 12px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
            padding: 30px;
            margin-bottom: 40px;
            transition: transform 0.3s ease-in-out;
        }

        .card:hover {
            transform: translateY(-8px);
        }

        h2 {
            text-align: center;
            margin-top: 0;
            color: #2e3b4e;
            font-weight: 600;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
            border-radius: 10px;
            overflow: hidden;
        }

        th, td {
            padding: 14px 16px;
            border-bottom: 1px solid #eee;
            text-align: center;
            vertical-align: middle;
        }

        th {
            background-color: #f8f9fa;
            color: #333;
            font-weight: 600;
            text-transform: uppercase;
        }

        tr:hover {
            background-color: #f1f1f1;
        }

        /* 按钮样式 */
        .footer-btn {
            display: flex;
            justify-content: center;
            align-items: center;
            margin-top: 20px;
        }

        .footer-btn button {
            width: auto;
            padding: 10px 20px;
            border: 1px solid #ddd;
            border-radius: 8px;
            background-color: #4CAF50;
            color: #f2f2f2;
            cursor: pointer;
            transition: all 0.3s ease;
            margin: 0 10px;
        }

        .footer-btn button:hover {
            background-color: #45a049;
            transform: scale(1.05);
        }
    </style>
</head>
<body>

<!-- 导航栏 -->
<div class="navbar">
    <div class="btn">
        <a href="${pageContext.request.contextPath}/page/tenant/index.jsp">返回首页</a>
    </div>

    <div class="btn">
        <a><img src="${pageContext.request.contextPath}/static/LOGO.svg" alt="LOGO">欢迎：${account.username}</a>
        <a href="${pageContext.request.contextPath}/logout" onclick="return confirm('确定要退出登录吗？')">退出登录</a>
    </div>
</div>

<!-- 页面主体 -->
<div class="container">
    <div class="card">
        <h2>房源信息列表</h2>
        <table>
            <thead>
            <tr>
                <th>楼栋编号</th>
                <th>房间号</th>
                <th>卧室数</th>
                <th>卫生间数</th>
                <th>地址</th>
                <th>负责经理编号</th>
                <th>负责经理姓名</th>
                <th>负责经理电话</th>
            </tr>
            </thead>
            <tbody>
            <c:if test="${empty houses}">
                <tr>
                    <td colspan="4">暂无房源信息</td>
                </tr>
            </c:if>
            <c:forEach items="${houses}" var="house">
                <tr>
                    <td>${house.buildingId}</td>
                    <td>${house.apartmentNo}</td>
                    <td>${house.bedroomCount}</td>
                    <td>${house.bathroomCount}</td>
                    <td>${house.address}</td>
                    <td>${house.managerId}</td>
                    <td>${house.managerName}</td>
                    <td>${house.managerPhone}</td>
                </tr>
            </c:forEach>
            </tbody>
        </table>

        <div class="footer-btn">
            <button onclick="window.location.href='${pageContext.request.contextPath}/house'">刷新页面</button>
            <button onclick="window.location.href='${pageContext.request.contextPath}/'">返回首页</button>
        </div>
    </div>

</div>

<jsp:include page="/page/model/footer.jsp" />

</body>
</html>
